<?php if (Controller::$pageData['pageId'] == 3014): ?>
    <div class="model-list stretched" style="text-align:center;">
        <dl class="widget">
            <dt>Выберите Вашу линейку</dt>			
        </dl>
        <ul data-brand="3014" id="sortable1">
            <li style="width:30%;" data-id="3139">                
                <div class="model-list__item" style="max-width:250px;">
                    <div class="model-list__photo">
                        <a href="/remont-noutbukov/apple/macbook-pro"><img alt="Ремонт Macbook Pro" src="<?php echo $src = $this->getImageUrl('/image/resize/300x300/uploads/images/model/remont-noutbukov-apple-macbook-pro.jpg'); ?>"></a>
    <!--                        <span class="itemOverlay">
    <a href="#">Yandex Market</a>
    </span>-->
                    </div>

                    <span>
                        <a href="/remont-noutbukov/apple/macbook-pro">Macbook Pro</a>						
                    </span>
                </div>    
            </li>
            <li style="width:30%;" data-id="3033">                
                <div class="model-list__item" style="max-width:250px;">
                    <div class="model-list__photo">
                        <a href="/remont-noutbukov/apple/macbook-air"><img alt="Ремонт Macbook Air" src="<?php echo $src = $this->getImageUrl('/image/resize/200x200/uploads/images/model/remont-noutbukov-apple-macbook-air.jpeg'); ?>"></a>
    <!--                        <span class="itemOverlay">
    <a href="#">Yandex Market</a>
    </span>-->
                    </div>

                    <span>
                        <a href="/remont-noutbukov/apple/macbook-air">Macbook Air</a>						
                    </span>
                </div>    
            </li>

        </ul>
    </div>
<?php endif; ?>
<noindex>
    <div class="model-selection">
        <dl>
            <dt>Укажите вашу модель</dt>
            <dd>
                <div class="wrap-bg">
                    <noindex>
                        <div class="type-text">
                            <?php
                            $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
                                'name' => 'city',
                                'source' => $searches,
                                // additional javascript options for the autocomplete plugin
                                'options' => array(
                                    'minLength' => '0',
                                    'showAnim' => 'fold',
                                    'select' => 'js: function(event, ui)
							{
							
								window.location.href = "/" + ui.item.url;
								return false;
							}',
                                ),
                                'htmlOptions' => array(
                                    'placeholder' => 'Название модели',
                                ),
                            ));
                            ?>                   
                        </div>
                    </noindex>
                </div>     
            </dd>
        </dl>
        <p>Например: <a href="/<?php echo $random; ?>"><?php echo isset($array[$random]) ? $array[$random] : ''; ?></a></p>
    </div> 
</noindex>
<?php $this->widget('application.modules.main.widgets.cityPhonesInModelPage', array('title' => 'Если у Вас сложности с поиском модели, позвоните нам и получите бесплатную консультацию:')); ?>
<div class="model-list stretched">
    <ul id="sortable1" data-brand="<?php echo Controller::$pageData['pageId']; ?>">
        <?php foreach ($datas as $data): ?>
            <li data-id="<?php echo $data['pageId']; ?>">                
                <div class="model-list__item">
                    <div class="model-list__photo">
                        <?php if (!Yii::app()->user->isGuest && Yii::app()->user->name['userGroup'] == 'admin' && !empty($data['pageYandexId'])): ?>
                            <a class="status-list" href="http://market.yandex.ru/model.xml?modelid=<?php echo $data['pageYandexId']; ?>&int_lnk=p-goods" target="_blank">
                                <span class="status available">
                                    <span class="status__inner">
                                        <span>&nbsp;</span>                            
                                    </span>                            
                                </span>
                            </a>
                        <?php endif; ?>
                        <?php
                        $src = $this->getImageUrl('/image/resize/200x200/uploads/images/model/' . $data['pageImages']);
                        echo CHtml::link('<img src="' . $src . '" alt="Ремонт ' . Controller::$pageData['pageTitle'] . ' ' . $data['pageTitle'] . '">', '/' . $data['pageUrl']);
                        ?>

                                                                                    <!--                        <span class="itemOverlay">
                                                                                                 <a href="#">Yandex Market</a>
                                                                                             </span>-->
                    </div>

                    <span>
                        <?php echo CHtml::link(Controller::$pageData['pageTitle'] . ' ' . $data['pageTitle'], '/' . $data['pageUrl']); ?>						
                    </span>
                </div>    
            </li>
        <?php endforeach; ?>
    </ul>
</div> 

<!--<script>
    $(document).ready(function() {
        $('.model-list__photo').hover(
                function() {
                    $(this).find(".itemOverlay").animate({opacity: 0.8});
                },
                function() {
                    $(this).find(".itemOverlay").animate({opacity: 0.0});
                });
    });
</script>-->
<?php if (!Yii::app()->user->isGuest && Yii::app()->user->name['userGroup'] == 'admin' && isset($_GET['sort'])): ?>
    <script>
        $(function () {
            $("#sortable1").sortable({
                connectWith: ".connectedSortable"
            }).disableSelection();
            $('#save-sort').on('click', function () {
                mobi03.showMessage('Подождите пожалуйста, сортировка сохраняется...', '<div align="center"><img src="/themes/front/assets/images/windows-8-loading.png"></div>');
                var data = {items: []};
                $("#sortable1 li").each(function (index) {
                    data.items.push({id: $(this).data('id'), sort: index});
                });
                $.post('/main/ajax/modelsSort',
                        {models: data.items},
                function (response) {
                    if (response == 'success') {
                        window.location.href = window.location.pathname;
                    }
                });
            });
        });
    </script>

<?php endif; ?>
<div id="all-brands" class="brand-list" style="display: none;">
    <ul id="more-models">

    </ul>
</div>
<nav class="page-navi" id="see-more-navi" style="text-align: center; margin: 0 0 12px; background: none;">
    <div class="type-submit">
        <input type="submit" id="see-more-models" value="Показать еще моделей">			
    </div>
</nav>
<div align="center" style="padding-bottom: 10px; display: none;" id="loading"><img src="/themes/front/assets/images/loading.gif"></div>		
<script>
    $(function () {
        var offset = 0;
        $.ajaxSetup({cache: false});
        $('#see-more-models').on('click', function () {
            $('#loading').show();
            offset += 20;
            var bTitle = '<?php echo Controller::$pageData['pageTitle']; ?>';
            $.post('/main/ajax/getModels', {brand: parseInt(<?php echo Controller::$pageData['pageId']; ?>), offset: parseInt(offset), bTitle: bTitle}, function (resp) {
                var obj = jQuery.parseJSON(resp);
                if (obj.status == 'end') {
                    $('#see-more-models').hide();
                    $('#see-more-navi').hide();
                }
                $('#more-models').append(obj.content);
                $('#all-brands').show();
                $('#loading').hide();
            });
        });
    });
</script>

<nav class="page-navi" style="display: none;">
    <?php
    $this->widget('CLinkPager', array(
        'pages' => $pages,
        'header' => '',
        'cssFile' => Yii::app()->theme->baseUrl . '/assets/css/pager.css',
        'firstPageLabel' => '&lt;&lt;',
        'prevPageLabel' => 'Предыдущая страница',
        'nextPageLabel' => 'Следующая страница',
        'lastPageLabel' => '&gt;&gt;',
    ));
    ?>	
</nav>
<?php
if (in_array(Controller::$pageData['pageParent'], array(3, 6, 10))) {
    if (Controller::$pageData['pageParent'] == 3) {
        if (Controller::$pageData['pageId'] == 3014)
            $cid = 3139;
        else
            $cid = 21640;
    }
    if (Controller::$pageData['pageParent'] == 6) {
        $cid = 90607;
    }
    if (Controller::$pageData['pageParent'] == 10) {
        $cid = 91406;
    }
    $this->widget('application.modules.main.widgets.CategoryPriceList', array('category' => $cid));
}
?>
<?php //if (isset($relations[0]['pageDescription'])) $this->widget('application.modules.main.widgets.ServiceCentersTabs', array('brandUrl' => $relations[0]['pageDescription']));   ?>
<?php $this->widget('application.modules.main.widgets.cityPhonesInModelPage'); ?>
<?php $this->widget('application.modules.main.widgets.layoutBlocks', array('block' => 'under_price')); ?>

<style>
    .ui-autocomplete {
        max-height: 200px;
        overflow-y: auto;
        /* prevent horizontal scrollbar */
        overflow-x: hidden;
        /* add padding to account for vertical scrollbar */
        padding-right: 20px;
    }
    /* IE 6 doesn't support max-height
     * we use height instead, but this forces the menu to always be this tall
     */
    * html .ui-autocomplete {
        height: 100px;
    }

</style>